home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / PASCAL / 0195.ZIP / GETINTGR.PAS < prev    next >
Pascal/Delphi Source File  |  1984-12-19  |  1KB  |  35 lines

  1. {@@@@@@@@@@@ copyright (C) 1984 by Neil J. Rubenking @@@@@@@@@@@@@@@@@@@@@@@@
  2. The purchaser of these procedures and functions may include them in COMPILED
  3. programs freely, but may not sell or give away the source text.
  4.  
  5. }
  6. {$I getintgr.lib}
  7. var
  8.   MaxOne, MinOne, GotOne : integer;
  9. begin
  10.   repeat
  11.     ClrScr;
  12.     Write('Enter a maximum integer value: ');
  13.     Read(MaxOne);
  14.     WriteLn;
  15.     Write('Enter a minimum integer value: ');
  16.     read(MinOne);
  17.     if MaxOne <= MinOne then
  18.       begin
  19.         WriteLn;
  20.         WriteLn('Come on!  The minimum HAS to be less than the maximum!');
  21.         WriteLn('Press a key and I''l let you start over.');
  22.         repeat until keypressed;
  23.       end;
  24.   until MaxOne > MinOne;
  25.   WriteLn;WriteLn;
  26.   WriteLn('Now I''ll ASK you to enter an integer BETWEEN those two values,');
  27.   Write('but you pretend to be a dummy and get it wrong: ');
  28.   GotOne := GetInteger(MinOne,MaxOne);
  29.   WriteLn;
  30.   WRiteLn('Just got the Integer ',GotOne);
  31.   WriteLn;
  32.   WriteLn('You can use this procedure to protect your programs against being');
  33.   WriteLn('crashed by data entry errors.');
  34. end.
  35.